package com.abc.pro.model;

public class OddsEarlyEvent extends Event{
    // Odds information
    private EventType.O1x21st[] m1x21st;
    private EventType.Ah1st[] mAh1st;
    private EventType.Ou1st[] mOu1st;
    
    public OddsEarlyEvent(long id, String name) {
        super(id, name);
    }
    
    public OddsEarlyEvent(long id, String name, EventInfo info) {
        super(id, name, info);
    }
    
    @Override
    public int getCount(){
        int rs = 0, rs1st = 0;
        if(mAh == null && mOu == null){
            rs = 0;
        } else if(mOu == null){
            rs = mAh.length;
        } else if(mAh == null){
            rs = mOu.length;
        } else {
            rs = Math.max(mAh.length, mOu.length);
        }
        if(mAh1st == null && mOu1st == null){
            rs1st = 0;
        } else if(mAh1st == null){
            rs1st = mOu1st.length;
        } else if(mOu1st == null){
            rs1st = mAh1st.length;
        } else{
            rs1st = Math.max(mAh1st.length, mOu1st.length);
        }
        return Math.max(rs, rs1st);
    }
    
    public EventType.O1x21st[] get1x21st() {
        return m1x21st;
    }
    
    public void set1x21st(EventType.O1x21st[] m1x2) {
        this.m1x21st = m1x2;
    }
    
    public EventType.Ah1st[] getAh1st() {
        return mAh1st;
    }
    
    public void setAh1st(EventType.Ah1st[] asianHan) {
        this.mAh1st = asianHan;
    }
    
    public EventType.Ou1st[] getOu1st() {
        return mOu1st;
    }
    
    public void setOu1st(EventType.Ou1st[] overUnder) {
        this.mOu1st = overUnder;
    }

    @Override
    public void updateRowData(OddRow row, int line) {
        super.updateRowData(row, line);
        
        if(m1x21st != null && line < m1x21st.length){
            row.setHalf1x2Result(m1x21st[line].homeWinvalue);
            row.setHalf1x2Home(m1x21st[line].awayWinValue);
            row.setHalf1x2Away(m1x21st[line].drawValue);
        }
        
        if(mAh1st != null && line < mAh1st.length){
            row.setHalfhdp1(getAbsStr(mAh1st[line].homeValue));
            row.setHalfhdp2_1(mAh1st[line].homeOddsValue);
            row.setHalfhdp2_2(mAh1st[line].awayOddsValue);
        }
        
        if(mOu1st != null && line < mOu1st.length){
            row.setHalfou1(getAbsStr(mOu1st[line].overValue));
            row.setHalfou2_1(mOu1st[line].overOddsValue);
            row.setHalfou2_2(mOu1st[line].underOddsValue);
        }
    }
}
